{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="mb-20" method="get" action="{:\\think\\Url::build($Request.action)}">
        <input type="text" class="input-text" style="width:250px" placeholder="id" name="id" value="{$Request.param.id}">
        <input type="text" class="input-text" style="width:250px" placeholder="客服电话" name="phone" value="{$Request.param.phone}">
        <button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
    </form>
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">
            <a class="btn btn-primary radius" href="javascript:" onclick="layer_open('添加','/admin/message/add_service_info/id/{$vo.id}')"><i class="Hui-iconfont">&#xe600;</i> 添加</a>
        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count ?? '0'}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            <th width="">id</th>
            <th width="">客服电话</th>
            <th width="70">操作</th>
        </tr>
        </thead>
        {if empty($list)}
            <tbody>
                <tr class="text-c">
                    <td colspan="3">暂无信息</td>
                </tr>
            </tbody>
        {else/}
            <tbody>
            {volist name="list" id="vo"}
            <tr class="text-c">
                <td>{$vo.id}</td>
                <td>{$vo.phone}</td>
                <td class="f-14">
                    <a title="编辑" href="javascript:;" onclick="layer_open('编辑','/admin/message/edit_service_info/id/{$vo.id}')" style="text-decoration:none" class="ml-5 label label-warning radius">编辑</a>
                    <a title="删除" href="javascript:;" onclick="del('{$vo.id}')" style="text-decoration:none" class="ml-5 label label-warning radius">删除</a>
                </td>
            </tr>
            {/volist}
            </tbody>
        {/if}
    </table>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
{/block}
{block name="script"}
    <script>
        function del(id){
            console.log('123');

            $.ajax({
                type: 'POST',
                url: '/admin/message/del_service_info',
                data: {
                    id:id
                },
                success: function (res){
                    if(res.code == 0){
                        layer.msg(res.msg, {
                            time: 2000, //2s后自动关闭
                        },function () {
                            //关闭后刷新
                            location.reload();
                        });
                    }else{
                        ajax_progress(res);
                    }
                },
            });
        }
    </script>
{/block}
